package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.server.SettingsService;
import com.tanhua.model.domain.Settings;
import com.tanhua.model.vo.PageResult;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class SettingsApiImpl implements SettingsApi{
    @Autowired
    private SettingsService settingsService;

    @Override
    public Settings getByUserId(Long userId) {
        LambdaQueryWrapper<Settings> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Settings::getUserId, userId);
        return settingsService.getOne(queryWrapper);
    }

    @Override
    public void save(Settings settings) {
        settingsService.save(settings);
    }

    @Override
    public void update(Settings settings) {
        settingsService.updateById(settings);
    }



}
